
list(APPEND SOURCE_CRTDLL
#    _CIacos.c
#    _CIasin.c
#    _CIatan.c
#    _CIatan2.c
#    _CIcosh.c
#    _CIcos.c
#    _CIexp.c
#    _CIfmod.c
#    _CIlog.c
#    _CIlog10.c
#    _CIpow.c
#    _CIsin.c
#    _CIsinh.c
#    _CIsqrt.c
#    _CItan.c
#    _CItanh.c
#    _HUGE_dll.c
#    _XcptFilter.c
#    __GetMainArgs.c
#    __argc_dll.c
#    __argv_dll.c
#    __dllonexit.c
#    __doserrno.c
#    __fpecode.c
#    __isascii.c
#    __iscsym.c
#    __iscsymf.c
#    __mb_cur_max_dll.c
#    __pxcptinfoptrs.c
#    __threadhandle.c
#    __threadid.c
#    __toascii.c
#    _abnormal_termination.c
#    _access.c
#    _acmdln_dll.c
#    _aexit_rtn_dll.c
#    _amsg_exit.c
#    _assert.c
#    _basemajor_dll.c
#    _baseminor_dll.c
#    _baseversion_dll.c
#    _beep.c
#    _beginthread.c
#    _c_exit.c
#    _cabs.c
#    _cexit.c
#    _cgets.c
#    _chdir.c
#    _chdrive.c
#    _chgsign.c
#    _chmod.c
#    _chsize.c
#    _clearfp.c
#    _close.c
#    _commit.c
#    _commode_dll.c
#    _control87.c
#    _controlfp.c
#    _copysign.c
#    _cprintf.c
#    _cpumode_dll.c
#    _cputs.c
#    _creat.c
#    _cscanf.c
#    _ctype.c
#    _cwait.c
#    _daylight_dll.c
#    _dup.c
#    _dup2.c
#    _ecvt.c
#    _endthread.c
#    _environ_dll.c
#    _eof.c
#    _errno.c
#    _except_handler2.c
#    _execl.c
#    _execle.c
#    _execlp.c
#    _execlpe.c
#    _execv.c
#    _execve.c
#    _execvp.c
#    _execvpe.c
#    _exit.c
#    _expand.c
#    _fcloseall.c
#    _fcvt.c
#    _fdopen.c
#    _fgetchar.c
#    _fgetwchar.c
#    _filbuf.c
#    _fileinfo_dll.c
#    _filelength.c
#    _fileno.c
#    _findclose.c
#    _findfirst.c
#    _findnext.c
#    _finite.c
#    _flsbuf.c
#    _flushall.c
#    _fmode_dll.c
#    _fpclass.c
#    _fpieee_flt.c
#    _fpreset.c
#    _fputchar.c
#    _fputwchar.c
#    _fsopen.c
#    _fstat.c
#    _ftime.c
#    _ftol.c
#    _fullpath.c
#    _futime.c
#    _gcvt.c
#    _get_osfhandle.c
#    _getch.c
#    _getche.c
#    _getcwd.c
#    _getdcwd.c
#    _getdiskfree.c
#    _getdllprocaddr.c
#    _getdrive.c
#    _getdrives.c
#    _getpid.c
#    _getsystime.c
#    _getw.c
#    _global_unwind2.c
#    _heapchk.c
#    _heapmin.c
#    _heapset.c
#    _heapwalk.c
#    _hypot.c
#    _initterm.c
#    _iob.c
#    _isatty.c
#    _isctype.c
#    _ismbbalnum.c
#    _ismbbalpha.c
#    _ismbbgraph.c
#    _ismbbkalnum.c
#    _ismbbkana.c
#    _ismbbkpunct.c
#    _ismbblead.c
#    _ismbbprint.c
#    _ismbbpunct.c
#    _ismbbtrail.c
#    _ismbcalpha.c
#    _ismbcdigit.c
#    _ismbchira.c
#    _ismbckata.c
#    _ismbcl0.c
#    _ismbcl1.c
#    _ismbcl2.c
#    _ismbclegal.c
#    _ismbclower.c
#    _ismbcprint.c
#    _ismbcspace.c
#    _ismbcsymbol.c
#    _ismbcupper.c
#    _ismbslead.c
#    _ismbstrail.c
#    _isnan.c
#    _itoa.c
#    _itow.c
#    _j0.c
#    _j1.c
#    _jn.c
#    _kbhit.c
#    _lfind.c
#    _loaddll.c
#    _local_unwind2.c
#    _locking.c
#    _logb.c
#    _lrotl.c
#    _lrotr.c
#    _lsearch.c
#    _lseek.c
#    _ltoa.c
#    _ltow.c
#    _makepath.c
#    _matherr.c
#    _mbbtombc.c
#    _mbbtype.c
#    _mbccpy.c
#    _mbcjistojms.c
#    _mbcjmstojis.c
#    _mbclen.c
#    _mbctohira.c
#    _mbctokata.c
#    _mbctolower.c
#    _mbctombb.c
#    _mbctoupper.c
#    _mbctype.c
#    _mbsbtype.c
#    _mbscat.c
#    _mbschr.c
#    _mbscmp.c
#    _mbscpy.c
#    _mbscspn.c
#    _mbsdec.c
#    _mbsdup.c
#    _mbsicmp.c
#    _mbsinc.c
#    _mbslen.c
#    _mbslwr.c
#    _mbsnbcat.c
#    _mbsnbcmp.c
#    _mbsnbcnt.c
#    _mbsnbcpy.c
#    _mbsnbicmp.c
#    _mbsnbset.c
#    _mbsncat.c
#    _mbsnccnt.c
#    _mbsncmp.c
#    _mbsncpy.c
#    _mbsnextc.c
#    _mbsnicmp.c
#    _mbsninc.c
#    _mbsnset.c
#    _mbspbrk.c
#    _mbsrchr.c
#    _mbsrev.c
#    _mbsset.c
#    _mbsspn.c
#    _mbsspnp.c
#    _mbsstr.c
#    _mbstok.c
#    _mbstrlen.c
#    _mbsupr.c
#    _memccpy.c
#    _memicmp.c
#    _mkdir.c
#    _mktemp.c
#    _msize.c
#    _nextafter.c
#    _onexit.c
#    _open.c
#    _open_osfhandle.c
#    _osmajor_dll.c
#    _osminor_dll.c
#    _osmode_dll.c
#    _osver_dll.c
#    _osversion_dll.c
#    _pclose.c
#    _pctype_dll.c
#    _pgmptr_dll.c
#    _pipe.c
#    _popen.c
#    _purecall.c
#    _putch.c
#    _putenv.c
#    _putw.c
#    _pwctype_dll.c
#    _read.c
#    _rmdir.c
#    _rmtmp.c
#    _rotl.c
#    _rotr.c
#    _scalb.c
#    _searchenv.c
#    _seterrormode.c
#    _setjmp.c
#    _setmode.c
#    _setsystime.c
#    _sleep.c
    _snprintf.c
    _snwprintf.c#    _sopen.c
#    _spawnl.c
#    _spawnle.c
#    _spawnlp.c
#    _spawnlpe.c
#    _spawnv.c
#    _spawnve.c
#    _spawnvp.c
#    _spawnvpe.c
#    _splitpath.c
#    _stat.c
#    _statusfp.c
#    _strcmpi.c
#    _strdate.c
#    _strdec.c
#    _strdup.c
#    _strerror.c
#    _stricmp.c
#    _stricoll.c
#    _strinc.c
#    _strlwr.c
#    _strncnt.c
#    _strnextc.c
#    _strnicmp.c
#    _strninc.c
#    _strnset.c
#    _strrev.c
#    _strset.c
#    _strspnp.c)
#    _strtime.c
#    _strupr.c
#    _swab.c
#    _sys_errlist.c
#    _sys_nerr_dll.c
#    _tell.c
#    _tempnam.c
#    _timezone_dll.c
#    _tolower.c
#    _toupper.c
#    _tzname.c
#    _tzset.c
#    _ultoa.c
#    _ultow.c
#    _umask.c
#    _ungetch.c
#    _unlink.c
#    _unloaddll.c
#    _utime.c
    _vsnprintf.c
    _vsnwprintf.c
#    _wcsdup.c
#    _wcsicmp.c
#    _wcsicoll.c
#    _wcslwr.c
#    _wcsnicmp.c
#    _wcsnset.c
#    _wcsrev.c
#    _wcsset.c
#    _wcsupr.c
#    _winmajor_dll.c
#    _winminor_dll.c
#    _winver_dll.c
#    _write.c
#    _wtoi.c
#    _wtol.c
#    _y0.c
#    _y1.c
#    _yn.c
#    abort.c
#    abs.c
#    acos.c
#    asctime.c
#    asin.c
#    atan.c
#    atan2.c
#    atexit.c
#    atof.c
#    atoi.c
#    atol.c
#    bsearch.c
#    calloc.c
#    ceil.c
#    clearerr.c
#    clock.c
#    cos.c
#    cosh.c
#    ctime.c
#    difftime.c
#    div.c
#    exit.c
#    exp.c
#    fabs.c
#    fclose.c
#    feof.c
#    ferror.c
#    fflush.c
#    fgetc.c
#    fgetpos.c
#    fgets.c
#    fgetwc.c
#    floor.c
#    fmod.c
#    fopen.c
#    fprintf.c
#    fputc.c
#    fputs.c
#    fputwc.c
#    fread.c
#    free.c
#    freopen.c
#    frexp.c
#    fscanf.c
#    fseek.c
#    fsetpos.c
#    ftell.c
#    fwprintf.c
#    fwrite.c
#    fwscanf.c
#    getc.c
#    getchar.c
#    getenv.c
#    gets.c
#    gmtime.c
#    is_wctype.c
#    isalnum.c
#    isalpha.c
#    iscntrl.c
#    isdigit.c
#    isgraph.c
#    isleadbyte.c
#    islower.c
#    isprint.c
#    ispunct.c
#    isspace.c
#    isupper.c
#    iswalnum.c
#    iswalpha.c
#    iswascii.c
#    iswcntrl.c
#    iswctype.c
#    iswdigit.c
#    iswgraph.c
#    iswlower.c
#    iswprint.c
#    iswpunct.c
#    iswspace.c
#    iswupper.c
#    iswxdigit.c
#    isxdigit.c
#    labs.c
#    ldexp.c
#    ldiv.c
#    localeconv.c
#    localtime.c
#    log.c
#    log10.c
#    longjmp.c
#    malloc.c
#    mblen.c
    mbstowcs.c
#    mbtowc.c
#    memchr.c
#    memcmp.c
#    memcpy.c
#    memmove.c
#    memset.c
#    mktime.c
#    modf.c
#    perror.c
#    pow.c
#    printf.c
#    putc.c
#    putchar.c
#    puts.c
#    qsort.c
#    raise.c
#    rand.c
#    realloc.c
#    remove.c
#    rename.c
#    rewind.c
#    scanf.c
#    setbuf.c
#    setlocale.c
#    setvbuf.c
#    signal.c
#    sin.c
#    sinh.c
    sprintf.c
#    sqrt.c
#    srand.c
#    sscanf.c
#    strcat.c
#    strchr.c
#    strcmp.c
#    strcoll.c
    strcpy.c
#    strcspn.c
#    strerror.c
#    strftime.c
    strlen.c
#    strncat.c
#    strncmp.c
#    strncpy.c
#    strpbrk.c
#    strrchr.c
#    strspn.c
#    strstr.c
#    strtod.c
#    strtok.c
#    strtol.c
    strtoul.c
#    strxfrm.c
#    swprintf.c
#    swscanf.c
#    system.c
#    tan.c
#    tanh.c
#    time.c
#    tmpfile.c
#    tmpnam.c
#    tolower.c
#    toupper.c
#    towlower.c
#    towupper.c
#    ungetc.c
#    ungetwc.c
#    vfprintf.c
#    vfwprintf.c
#    vprintf.c
#    vsprintf.c
#    vswprintf.c
#    vwprintf.c
#    wcscat.c
#    wcschr.c
#    wcscmp.c
#    wcscoll.c
#    wcscpy.c
#    wcscspn.c
#    wcsftime.c
#    wcslen.c
#    wcsncat.c
#    wcsncmp.c
#    wcsncpy.c
#    wcspbrk.c
#    wcsrchr.c
#    wcsspn.c
#    wcsstr.c
#    wcstod.c
#    wcstok.c
#    wcstol.c
    wcstombs.c
    wcstoul.c
#    wcsxfrm.c
#    wctomb.c
#    wprintf.c
#    wscanf.c
)

if(ARCH STREQUAL "i386")
    list(APPEND SOURCE_CRTDLL
    #    _CIpow.c
    #    _ftol.c
    #    _alldiv.c
    #    _alldvrm.c
    #    _allmul.c
    #    _allrem.c
    #    _allshl.c
    #    _allshr.c
    #    _alloca_probe.c
    #    _aulldiv.c
    #    _aulldvrm.c
    #    _aullrem.c
    #    _aullshr.c
    #    _chkstk.c
    )
elseif(ARCH STREQUAL "amd64")
    list(APPEND SOURCE_CRTDLL
    #    __C_specific_handler
    #    _setjmp.c
    #    _setjmpex.c
    #    _local_unwind.c
    #    longjmp.c
    )
endif()


add_executable(crtdll_crt_apitest testlist.c ${SOURCE_CRTDLL})
target_compile_definitions(crtdll_crt_apitest PRIVATE TEST_CRTDLL)
target_link_libraries(crtdll_crt_apitest wine ${PSEH_LIB})
set_module_type(crtdll_crt_apitest win32cui)
add_importlibs(crtdll_crt_apitest crtdll msvcrt kernel32 ntdll)
add_rostests_file(TARGET crtdll_crt_apitest)
